package com.hung.triple.heartbeat;

import io.netty.util.HashedWheelTimer;
import io.netty.util.Timer;

import java.util.concurrent.TimeUnit;

/**
 * @author Hung
 * @date 2023/2/10 1:33
 */
public class TimerHolder {

    private TimerHolder() {
    }

    public static Timer getTimer() {
        return TimerHolder.DefaultInstance.INSTANCE;
    }

    private static class DefaultInstance {
        static final Timer INSTANCE;

        static {
            INSTANCE = new HashedWheelTimer(new NamedThreadFactory("DefaultTimer10", true), 10L, TimeUnit.MILLISECONDS);
        }

        private DefaultInstance() {
        }
    }
}
